1. Field of the Invention
The present invention generally relates to the messaging interface between a computer application program and a windowing operating system and, more particularly, to a method and architecture for taking an existing application program that is totally message driven and converting it such that the need for messages on a lower priority thread is avoided.
2. Description of the Prior Art
The invention is described in terms of the International Business Machines (IBM) Corporation 32-bit windowing operating system (OS) for microcomputers known as OS/2. The windowing user interface for OS/2 is the Presentation Manager (PM). The architecture of an OS/2 PM application is based on a messaging interface. Messages are sent to windows of the application and are processed in a message procedure for that window. Each class of windows has its own unique message procedure to process messages in order to perform its intended function.
Many applications need to perform some processing on background, or worker, threads. The intent is that work performed on these background threads should be done at a lower system priority than work performed on the main user interface thread. The main thread should be free to respond immediately to any requests generated by the user interacting with the windows on the screen.
A problem exists when the background thread also needs to communicate with the windows. Since the PM realizes the need for the user interface thread to have the highest priority on the central processing unit (CPU), the PM raises the priority of any thread that sends messages to a PM window to be equal to that of the main user interface thread. For a background, low priority thread, this means that when it sends a message to a window, its priority is raised such that it is no longer executing in the background. This defeats the purpose of having a background thread at all, and it significantly decreases the performance of the main user interface thread as perceived by the user.
Since most functions that need to be performed on the background thread simply need to communicate with the window in order to get or set internal data, rather than actually interacting with the windows themselves, the raising of the background thread's priority is not desired. Without the messages from the background thread, the PM will not raise that thread's priority, and the processing will continue at the desired low priority and not impact the performance of the main user interface thread.